package cn.itsource.controller;

import cn.itsource.User;
import cn.itsource.feignclients.UserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class OrderController {

    @Autowired
    private UserFeignClient userFeignClient;

    @GetMapping(value = "/order/user/{id}",produces = "application/json")
    public User getUser(@PathVariable("id") Integer id){
        //通过Feign远程调用用户服务
        return userFeignClient.getuser(id);

    }

}
